package com.weimei.conversionTreasure.viewModel;

import android.app.Activity;
import android.app.Application;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.lxj.xpopup.XPopup;
import com.weimei.conversionTreasure.activity.AddRecordActivity;
import com.weimei.conversionTreasure.http.Repository;
import com.weimei.conversionTreasure.http.entity.PaoLiangListBean;
import com.weimei.conversionTreasure.weight.BottomDelPop;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class PLItemVM extends ItemViewModel {
    public ObservableField<PaoLiangListBean.DataDTO> entity = new ObservableField<>();

    public PLItemVM(@NonNull BaseViewModel viewModel, PaoLiangListBean.DataDTO dataDTO) {
        super(viewModel);
        entity.set(dataDTO);
    }

    DRVM mDRVM;
    public void setViewModel(DRVM drvm){
        mDRVM = drvm;
    }

    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("id",entity.get().getId()+"");
            bundle.putString("flag","1");
            viewModel.startActivity(AddRecordActivity.class,bundle);
        }
    });

    public BindingCommand itemLongClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            mDRVM.delNotice(entity.get().getId());
        }
    });

}
